const express = require('express');
const router = express.Router();
const paging = require('../../commonPaging/paging')


router.post('/',async (req,res) => {
    let {
        sheepId,  //羊只编号
        level,     //等级
        year,  //年度  为数字单一
        bodyHightMax,   //体高区间右
        bodyHightMin,   //体高区间左
        bodyLengthMax,    //体长区间右
        bodyLengthMin,    //体长区间左
        bustMax,        //胸围区间右
        bustMin,        //胸围区间左
        bodyWeightMax,  //体重区间右
        bodyWeightMin,  //体重区间左
        pileLengthMax,     //绒长度区间右
        pileLengthMin,      //绒长度区间左
        pileYieldMax,       //绒产量区间右
        pileYieldMin,       //绒产量区间左
        tubeMax,            //管围区间右
        tubeMin,            //管围区间左
        fineMax,            //绒细度区间右
        fineMin,            //绒细度区间左
        pileThicknessMax,      //绒厚度区间右
        pileThicknessMin,        //绒厚度区间左
    }=req.body
    let arr = [
        sheepId,  //羊只编号
        level,     //等级
        year,  //年度
        bodyHightMax,   //体高区间右
        bodyHightMin,   //体高区间左
        bodyLengthMax,    //体长区间右
        bodyLengthMin,    //体长区间左
        bustMax,        //胸围区间右
        bustMin,        //胸围区间左
        bodyWeightMax,  //体重区间右
        bodyWeightMin,  //体重区间左
        pileLengthMax,     //绒长度区间右
        pileLengthMin,      //绒长度区间左
        pileYieldMax,       //绒产量区间右
        pileYieldMin,       //绒产量区间左
        tubeMax,            //管围区间右
        tubeMin,            //管围区间左
        fineMax,            //绒细度区间右
        fineMin,            //绒细度区间左
        pileThicknessMax,      //绒厚度区间右
        pileThicknessMin,        //绒厚度区间左
    ] //转化为数组
    //req.body无数据
    if(arr.length === 0){
        return res.send({
            code: 1,
            msg: '参数错误'
        })
    }
    try{
        await paging(req,res,arr,'TestRong')
    }catch (e) {
        console.log(e);
        return res.send({
            code: 4,
            msg: '服务器错误,请稍后再试'
        })
    }
})

module.exports = router
